We can use the base plot functions in R to create a plot of the pdf for a beta random variable \(X\) with parameters \(\alpha\) and \(\beta\). Note that R defines \(\alpha=\) shape11 and \(\beta=\) shape12.
x <- seq(0, 1, by=0.001)
plot(x, dbeta(x, shape1=0.5, shape2=0.5), lty=1, col=1, type="l", xlab="x", ylab="f(x)", ylim=c(0,3))
lines(x, dbeta(x, shape1=1, shape2=0.5), lty=2, col=2)
lines(x, dbeta(x, shape1=2, shape2=0.5), lty=3, col=3)
lines(x, dbeta(x, shape1=0.5, shape2=1), lty=4, col=4)
lines(x, dbeta(x, shape1=1, shape2=1), lty=5, col=5)
lines(x, dbeta(x, shape1=2, shape2=1), lty=6, col=6)
lines(x, dbeta(x, shape1=0.5, shape2=2), lty=7, col=7)
lines(x, dbeta(x, shape1=1, shape2=2), lty=8, col=8)
lines(x, dbeta(x, shape1=2, shape2=2), lty=9, col=9)
The CDF may be plotted analogously.
x <- seq(0, 1, by=0.001)
plot(x, pbeta(x, shape1=0.5, shape2=0.5), lty=1, col=1, type="l", xlab="x", ylab="F(x)")
lines(x, pbeta(x, shape1=1, shape2=0.5), lty=2, col=2)
lines(x, pbeta(x, shape1=2, shape2=0.5), lty=3, col=3)
lines(x, pbeta(x, shape1=0.5, shape2=1), lty=4, col=4)
lines(x, pbeta(x, shape1=1, shape2=1), lty=5, col=5)
lines(x, pbeta(x, shape1=2, shape2=1), lty=6, col=6)
lines(x, pbeta(x, shape1=0.5, shape2=2), lty=7, col=7)
lines(x, pbeta(x, shape1=1, shape2=2), lty=8, col=8)
lines(x, pbeta(x, shape1=2, shape2=2), lty=9, col=9)
The special case of the beta(1,1) is actually a U(0,1). Interesting, but not very helpful.
x <- seq(0, 1, by=0.001)
plot(x, dbeta(x, shape1=1, shape2=1), lty=2, col=2, type="l", xlab="x", ylab="f(x)", ylim=c(-0.1,1.1))
lines(x, dunif(x, 0, 1), lty=3, col=3)
plot(x, pbeta(x, shape1=1, shape2=1), lty=2, col=2, type="l", xlab="x", ylab="F(x)")
lines(x, punif(x, 0, 1), lty=3, col=3)